<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div :style='{fontSize:fontSize+"px"}'>{{msg}}</div>
        <hello-world v-on:myevent='handle($event)'></hello-world>
    </div>
    <script src="../vue.js"></script>
    <script>
        Vue.component('hello-world', {
            props: ['fontSize'],
            data: function() {

            },
            template: `
                <div>
                    <button @click="$emit('myevent',5)">子向父传值</button>    
                </div>
            `
        })
        var vm = new Vue({
            el: '#app',
            data: {
                msg: '父组件的内容',
                fontSize: 10
            },
            methods: {
                handle: function(val) {
                    this.fontSize += val
                }
            }
        })
    </script>
</body>

</html>